import Vue from 'vue'
import App from './App.vue'
// import 'animate.css'
// import 'animate.css';
// import animated from 'animate.css' // 引入
// Vue.use(animated) // 全局注册
import "./assets/css/animated.css"
import router from './router'
import api from './api/index.js'



Vue.config.productionTip = false
import "./assets/iconfont/iconfont.css"
Vue.prototype.$api = api
router.beforeEach((to, form, next) => {
  api.cancel()
  window.document.title = to.meta.title;
  next();
})
router.afterEach((to, from, next) => {
  window.scrollTo(0, 0)
});

import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
Vue.use(ElementUI);

// import Vconsole from 'vconsole'
// let vConsole = new Vconsole()
// Vue.use(vConsole)


import Vant from 'vant'
import '../node_modules/vant/lib/index.css'
Vue.use(Vant)

Vue.prototype.isMobile = function () {//changeData是函数名
  let userAgent = navigator.userAgent.toLowerCase();
  // 用 test 匹配浏览器信息
  if (/ipad|iphone|midp|rv:1.2.3.4|ucweb|android|windows ce|windows mobile/.test(userAgent)) {
    return true;
  } else {
    // if (window.innerWidth <= 800) {
    //   return true
    // } else {
    //   return false
    // }
    // if (this.isTablet()) {
    //   return true
    // }
    return false
  }
}



Vue.prototype.wxload = function () {//changeData是函数名
  location.href = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=APPID&redirect_uri=REDIRECT_URI&response_type=code&scope=SCOPE&state=STATE#wechat_redirect"
}

function isTablet() {
  const userAgent = navigator.userAgent || navigator.vendor || window.opera;

  // Android tablets are notified with a user agent containing "Android" and "Mobile"
  if (/Android|iPad|iPod|iPhone/.test(userAgent) && !/Mobile Safari/.test(userAgent)) {
    return true;
  }

  // iOS tablets are notified with a user agent containing "iPad"
  if (/iPad/.test(userAgent)) {
    return true;
  }

  return false;
}

new Vue({
  router,
  render: h => h(App),
}).$mount('#app')
